/** \file    ProfileParams.h
  * \brief   Defines parameters affecting building of profiles.
  * \date    2001 - 2003
  * \author  Fedor Chelnokov
  * \version $Header: /home/cscom1r4/cvsroot/cs/include/segm/ProfileParams.h,v 1.1 2004/05/20 09:11:45 cscom1r4 Exp $
  */

#ifndef _ProfileParams_h_
#define _ProfileParams_h_

enum Distinction {
	DIST_CORRELATION,
	DIST_DISPERSION
};

enum LimitativeFunc {
	LIMF_NONE,
	LIMF_THRESHOLD,
	LIMF_SMOOTH
};

enum ProfileType {
	PROFILE_INTERNAL,	///<internal pixeles
	PROFILE_AUTOCORRELATION, ///<Sasha's difference of two profiles
	PROFILE_FOREIGN_ABS,
	PROFILE_FOREIGN_MIN
};

struct ProfileParams {
	///Type of image difference function.
	Distinction distinction;

	///Function to limit the influence of large image dissimilarity.
	LimitativeFunc limitativeFunc;

	///Determines how the program calculates segment correlation with the target frame.
	ProfileType profileType;

	///Maximum displacement in any direction during segment matching.
	unsigned	maxDisplacement;

	///Maximum displacement in any direction during segment matching with the same image (for self correlation).
	unsigned	maxSelfDisplacement;

	///Size of the region around mask to contain foreign segments.
	///Its pixel width is this value times the square root of the mean segment pixel size.
	float		foreignAreaWidth;

	///Coeffitient before dispersion in the color difference attenuation function.
	float		factorSqSigma;

	///Valid only for foreign profile types (min or abs)!
	///Sets the weight of the pair-profile in the overall profile of border segments.
	float		foreignRho;

	bool foreign() const
		{ return profileType == PROFILE_FOREIGN_ABS || profileType == PROFILE_FOREIGN_MIN; }

	bool operator == (const ProfileParams & p) const
	{
		return distinction == p.distinction
			&& limitativeFunc == p.limitativeFunc
			&& profileType == p.profileType
			&& maxDisplacement == p.maxDisplacement
			&& maxSelfDisplacement == p.maxSelfDisplacement
			&& foreignAreaWidth == p.foreignAreaWidth
			&& factorSqSigma == p.factorSqSigma
			&& foreignRho == p.foreignRho;
	}
	bool operator != (const ProfileParams & p) const
		{ return !operator == (p); }
};

#endif //_ProfileParams_h_
